<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Blog," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="系统版本macOS 10.12.1，node版本是v5.12.0

安装Hexo安装Hexo
1npm install hexo-cli -g
初始化
1hexo init Blog
初始化完成，Blog目录就是博客的根目录，所有的操作都在里面进行。">
<meta property="og:type" content="article">
<meta property="og:title" content="Mac上部署Hexo">
<meta property="og:url" content="http://www.vitah.net/posts/84fecfb1/index.html">
<meta property="og:site_name" content="Vitah's Blog">
<meta property="og:description" content="系统版本macOS 10.12.1，node版本是v5.12.0

安装Hexo安装Hexo
1npm install hexo-cli -g
初始化
1hexo init Blog
初始化完成，Blog目录就是博客的根目录，所有的操作都在里面进行。">
<meta property="og:updated_time" content="2016-11-24T08:16:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Mac上部署Hexo">
<meta name="twitter:description" content="系统版本macOS 10.12.1，node版本是v5.12.0

安装Hexo安装Hexo
1npm install hexo-cli -g
初始化
1hexo init Blog
初始化完成，Blog目录就是博客的根目录，所有的操作都在里面进行。">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://www.vitah.net/posts/84fecfb1/"/>





  <title> Mac上部署Hexo | Vitah's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Vitah's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocapitalize="off" autocomplete="off" autocorrect="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://www.vitah.net/posts/84fecfb1/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Vitah">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/head.JPG">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Vitah's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Mac上部署Hexo
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-11-24T16:16:33+08:00">
                2016-11-24
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Blog/" itemprop="url" rel="index">
                    <span itemprop="name">Blog</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/posts/84fecfb1/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="posts/84fecfb1/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><strong>系统版本macOS 10.12.1，node版本是v5.12.0</strong></p>
<hr>
<h3 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装<code>Hexo</code></h3><p>安装Hexo</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-cli -g</div></pre></td></tr></table></figure>
<p>初始化</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo init Blog</div></pre></td></tr></table></figure>
<p>初始化完成，<strong><code>Blog</code>目录就是博客的根目录，所有的操作都在里面进行</strong>。</p>
<a id="more"></a>
<h3 id="Github仓库设置"><a href="#Github仓库设置" class="headerlink" title="Github仓库设置"></a><a href="https://github.com/" target="_blank" rel="external"><code>Github</code></a>仓库设置</h3><p>注册账号，然后建立Repository，<strong>仓库名必须为<code>your_user_name.github.io</code></strong>，这里我的用户名是<code>vitahlin</code>，则仓库名是<code>vitahlin.github.io</code>。</p>
<h3 id="设置推送到Github"><a href="#设置推送到Github" class="headerlink" title="设置推送到Github"></a>设置推送到<code>Github</code></h3><p>修改<code>Blog</code>目录下的<code>_config.yml</code>文件，底部的<code>deploy</code>项目，修改：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">deploy:</div><div class="line">  type: git</div><div class="line">  repo: git@github.com:user_name/user_name.github.io.git</div><div class="line">  branch: master</div></pre></td></tr></table></figure></p>
<p>修改后保存，然后执行命令<code>npm install hexo-deployer-git --save</code>，再执行配置命令<code>hexo deploy</code>就可以在浏览器中打开链接<code>http://user_name.github.io/</code> 就可以看到自己的博客了。</p>
<h4 id="Git设置ssh方式"><a href="#Git设置ssh方式" class="headerlink" title="Git设置ssh方式"></a>Git设置ssh方式</h4><p>上面<code>repo</code>设置方式为<code>git</code>的话，需要为<code>Github</code>生成<code>SSH Key</code>。参考链接：<a href="https://help.github.com/articles/generating-an-ssh-key/" target="_blank" rel="external">链接地址</a>  进行设置，或者百度一下”git ssh”很多网友写的中文介绍。</p>
<h3 id="设置自己的域名"><a href="#设置自己的域名" class="headerlink" title="设置自己的域名"></a>设置自己的域名</h3><p>在Hexo的source目录下添加CNAME文件，没有任何后缀，在文件中填写要绑定的域名，如<code>www.user_name.net</code>。<br>然后设置域名解析，添加解析设置，纪录类型为CNAME,主机纪录www，解析线路为默认，然后纪录值填写github项目名称，如<code>user_name.github.io</code>，保存。<br>在Hexo中重新部署生成即可用自己的域名访问博客了。</p>
<p>参考链接</p>
<ul>
<li><a href="https://coding.net/help/doc/pages/index.html" target="_blank" rel="external">https://coding.net/help/doc/pages/index.html</a></li>
</ul>
<h3 id="设置部署到Coding"><a href="#设置部署到Coding" class="headerlink" title="设置部署到Coding"></a>设置部署到<a href="https://coding.net/user" target="_blank" rel="external"><code>Coding</code></a></h3><p>因为GitHub在海外，国内访问因为各种原因访问速度会很慢，这时候我们可以选择把Hexo也部署到Coding上面，然后国内的IP可以访问Coding，速度有很大提高。</p>
<p>在Coding上新建项目，项目名字要和用户名称一样。在Hexo的source目录下新建文件<code>Staticfile</code>，没有文件格式没有内容，是为了让Coding知道这是用于部署静态网站。</p>
<h4 id="设置部署公钥"><a href="#设置部署公钥" class="headerlink" title="设置部署公钥"></a>设置部署公钥</h4><h4 id="开启Page服务"><a href="#开启Page服务" class="headerlink" title="开启Page服务"></a>开启Page服务</h4><p>项目-代码-Pages服务中选择开启，如果有域名的话设置对应的域名。</p>
<h4 id="修改Hexo设置"><a href="#修改Hexo设置" class="headerlink" title="修改Hexo设置"></a>修改Hexo设置</h4><p>修改Hexo的设置，修改目录下的<code>_config.yml</code>文件中的<code>deploy</code>项，改为如下设置：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">deploy:</div><div class="line">  type: git</div><div class="line">  repo: </div><div class="line">    github: git@github.com:user_name/user_name.github.io.git,master</div><div class="line">    coding: git@git.coding.net:user_name/user_name.git,master</div></pre></td></tr></table></figure>
<p>地址的用户名改为自己的即可。<br>Coding的地址可以通过项目-代码查看。</p>
<h4 id="修改域名解析设置"><a href="#修改域名解析设置" class="headerlink" title="修改域名解析设置"></a>修改域名解析设置</h4><p>原来解析到GitHub的解析线路改为海外。新增两条解析设置解析到Coding的。最后设置如下：</p>
<table>
<thead>
<tr>
<th>记录类型</th>
<th>主机记录</th>
<th>解析线路</th>
<th>记录值</th>
</tr>
</thead>
<tbody>
<tr>
<td>CNAME</td>
<td>*</td>
<td>默认</td>
<td>user_name.coding.me</td>
</tr>
<tr>
<td>CNAME</td>
<td>www</td>
<td>默认</td>
<td>user_name.coding.me</td>
</tr>
<tr>
<td>CNAME</td>
<td>www</td>
<td>海外</td>
<td>user_name.github.io</td>
</tr>
</tbody>
</table>
<p><strong>上述中的user_name改为自己的用户名即可。</strong></p>
<h3 id="相关命令"><a href="#相关命令" class="headerlink" title="相关命令"></a>相关命令</h3><p>每次部署可以按以下步骤来执行：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">hexo clean</div><div class="line">hexo g</div><div class="line">hexo deploy</div></pre></td></tr></table></figure>
<p>一些常用命令：</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">hexo new"postName" #新建文章</div><div class="line">hexo new page"pageName" #新建页面</div><div class="line">hexo generate #生成静态页面至public目录</div><div class="line">hexo server #开启预览访问端口（默认端口4000，'ctrl + c'关闭server）</div><div class="line">hexo deploy #将.deploy目录部署到GitHub</div><div class="line">hexo help # 查看帮助</div><div class="line">hexo version #查看Hexo的版本</div></pre></td></tr></table></figure>

      
    </div>
    
    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script type="text/javascript" src="http://jslibs.wuxubj.cn/sweetalert_mini/jquery-1.7.1.min.js"></script>
  <script src="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.min.js"></script>
  <link rel="stylesheet" type="text/css" href="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.mini.css">

  <p><span>本文标题:</span><a href="/posts/84fecfb1/">Mac上部署Hexo</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 Vitah 的个人博客">Vitah</a></p>
  <p><span>发布时间:</span>2016年11月24日 - 16:11</p>
  <p><span>最后更新:</span>2016年11月24日 - 16:11</p>
  <p><span>原始链接:</span><a href="/posts/84fecfb1/" title="Mac上部署Hexo">http://www.vitah.net/posts/84fecfb1/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="http://www.vitah.net/posts/84fecfb1/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>

<script> 
    var clipboard = new Clipboard('.fa-clipboard');
	clipboard.on('success', $(function(){
	  $(".fa-clipboard").click(function(){
		swal({   
		  title: "",   
		  text: '复制成功',   
		  html: false,
		  timer: 500,   
		  showConfirmButton: false
	    });
	  });
    }));  
</script>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div></div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/images/wechatpay.jpeg" alt="Vitah WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/images/alipay.jpeg" alt="Vitah Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Blog/" rel="tag"># Blog</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/6cc1d170/" rel="next" title="expect用法">
                <i class="fa fa-chevron-left"></i> expect用法
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/cecc8cb2/" rel="prev" title="ssh证书登录">
                ssh证书登录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/head.JPG"
               alt="Vitah" />
          <p class="site-author-name" itemprop="name">Vitah</p>
           
              <p class="site-description motion-element" itemprop="description">深自缄默，如云漂泊。</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">47</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">14</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/vitahlin" target="_blank" title="Github">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  Github
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="mailto:linw1225@163.com" target="_blank" title="Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                  Mail
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-block">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              友情链接
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="https://shuge.org/" title="书格" target="_blank">书格</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://taozj.org/" title="taozj" target="_blank">taozj</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://oserror.com/" title="Charles" target="_blank">Charles</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.hsmouc.com/" title="Hsmouc" target="_blank">Hsmouc</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#安装Hexo"><span class="nav-number">1.</span> <span class="nav-text">安装Hexo</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Github仓库设置"><span class="nav-number">2.</span> <span class="nav-text">Github仓库设置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#设置推送到Github"><span class="nav-number">3.</span> <span class="nav-text">设置推送到Github</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Git设置ssh方式"><span class="nav-number">3.1.</span> <span class="nav-text">Git设置ssh方式</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#设置自己的域名"><span class="nav-number">4.</span> <span class="nav-text">设置自己的域名</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#设置部署到Coding"><span class="nav-number">5.</span> <span class="nav-text">设置部署到Coding</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#设置部署公钥"><span class="nav-number">5.1.</span> <span class="nav-text">设置部署公钥</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#开启Page服务"><span class="nav-number">5.2.</span> <span class="nav-text">开启Page服务</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改Hexo设置"><span class="nav-number">5.3.</span> <span class="nav-text">修改Hexo设置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改域名解析设置"><span class="nav-number">5.4.</span> <span class="nav-text">修改域名解析设置</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#相关命令"><span class="nav-number">6.</span> <span class="nav-text">相关命令</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Vitah</span>
</div>



        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      访客
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      总访问量
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>


        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  

    
      <script id="dsq-count-scr" src="https://http-www-vitah-net.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://www.vitah.net/posts/84fecfb1/';
          this.page.identifier = 'posts/84fecfb1/';
          this.page.title = 'Mac上部署Hexo';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://http-www-vitah-net.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  





  





  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>





  

  

  

  

  

</body>
</html>
